﻿using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Zune2LyncNP.src
{
    public static class Registro
    {
        public static Cancion leerRegistro()
        {
            Cancion cs = new Cancion();
            RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser,RegistryView.Default);
            key = key.OpenSubKey("Software\\ZuneNowPlaying");
            if (key != null)
            {
                var reproduciendo = key.GetValue("Playing").ToString() == "1"? true : false;
                var _artista = key.GetValue("Artist").ToString();
                var _album = key.GetValue("Album").ToString();
                var _cancion = key.GetValue("Title").ToString();
                if (reproduciendo)
                    cs = new Cancion(_cancion, _artista, _album);
            }
            return cs;
        }
        public static bool Reproduciendo()
        {
            RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default);
            key = key.OpenSubKey("Software\\ZuneNowPlaying");
            return key.GetValue("Playing").ToString() == "1"? true : false;
        }
    }
}
